package business;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import utils.ObjectPool;

import commonTypes.Dish;

import dao.DishesDao;

public class DishManager {
	private List<Dish> dishes = new ArrayList<Dish>();
	private DishesDao dishesDao;
	
	public DishManager(){
		BeanFactory factory= new ClassPathXmlApplicationContext("applicationContext.xml");
		this.dishesDao = (DishesDao)factory.getBean("dishesDao");
		dishes = this.dishesDao.getAllDishes();
		for(Dish dish:dishes){
			ObjectPool.push(dish);
		}
	}
	
	public List<Dish> getAllDishes(){
		return dishes;
	}


}
